package Server.Dwc.fkfish;

import java.util.Arrays;

import org.json.JSONObject;
import common.routine.JsonUtils;
import net.sf.json.*;
class IJsonExport {
	public String toString() {
		return getJsonData();
	}

	private String getJsonData() {
		return "";
	}

	public static String sprintf_BYTE(int by[][], int count) {
		int number = 0;
		int tmpCardData[] = new int[count]; // �û��˿�
		for (int i = 0; i < by.length; i++) {
			for (int k = 0; k < by[i].length; k++) {
				tmpCardData[number] = by[i][k];
				number++;
			}
		}
		String strCardData = sprintf_BYTE(tmpCardData, count);
		return strCardData;
	}

	public static String sprintf_BYTE(Integer by[][], int count) {

		int tmpCardData[] = new int[count]; // �û��˿�
		for (int i = 0; i < by.length; i++) {
			for (int k = 0; k < by[i].length; k++) {
				tmpCardData[i * by.length + k] = by[i][k];
			}
		}
		String strCardData = sprintf_BYTE(tmpCardData, count);
		return strCardData;
	}

	public static String sprintf_BYTE(Integer by[], int count) {
		return sprintf_INT32(by, count);
	}

	public static String sprintf_BYTE(int by[], int count) {
		return sprintf_INT32(by, count);
	}

	public static String sprintf_DWORD(int dw[], int count) {
		return sprintf_INT32(dw, count);
	}

	public static String sprintf_INT32(Integer dw[], int count) {
		if (count < 1) {
			return "";
		}
		StringBuffer out_str = new StringBuffer();
		out_str.append(dw[0]);
		for (int i = 1; i < count; i++) {
			out_str.append(",");
			out_str.append(dw[i]);
		}
		return out_str.toString();
	}

	public static String sprintf_DOUBLE(double dw[], int count) {
		if (count < 1) {
			return "";
		}
		StringBuffer out_str = new StringBuffer();
		out_str.append(dw[0]);
		for (int i = 1; i < count; i++) {
			out_str.append(",");
			out_str.append(dw[i]);
		}
		return out_str.toString();
	}

	public static String sprintf_INT32(int dw[], int count) {
		if (count < 1) {
			return "";
		}
		StringBuffer out_str = new StringBuffer();
		out_str.append(dw[0]);
		for (int i = 1; i < count; i++) {
			out_str.append(",");
			out_str.append(dw[i]);
		}
		return out_str.toString();
	}
}

class SUBCMD_S_Connect extends IJsonExport {

	int m_lUid;

	String getJsonData() {
		String ttzmsg = String.format("connect|%d", m_lUid);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};
//用户出牌
class SUBCMD_S_Guess extends IJsonExport 
{
   int 	byGuessBigSmall;  //压的是大还是小
   int 	byGuessNumber;  
   double           winCoin;
   double           totalCoin;
	String getJsonData()
	{
		String str =  String.format("guess|%d|%d|%g|%g",byGuessBigSmall,byGuessNumber,winCoin,totalCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};
//open|winCoin|totalCoin|result[12]|bet[16]|allbet[16]|winner|winnerCoin
//押注信息
class SUBCMD_S_Start extends IJsonExport 
{
  public int     byLotteryType;    
  public int  	byStartIndex;  
  public int 	    byHighRate;  
  public  int 	byLowRate;  
  public int     cbTableCardArray[] = new int[20];	//总共能开10个奖，拉火车，格式为  [结果，赢币数量]的配对
  public int     dwBet[] = new int[16];
  public double     dwWinCoin;
  public double     dwTotalCoin;	  


	String getJsonData(){		
		
		
		String strResult = sprintf_DWORD(cbTableCardArray,20);
		String strBet = sprintf_DWORD(dwBet,16);
		String str =  String.format("start|%d|%d|%d|%d|%s|%s|%g|%g\"",byHighRate,byLowRate,byLotteryType,byStartIndex,strResult,strBet,dwWinCoin,dwTotalCoin);
		
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};
//用户出牌
class SUBCMD_S_Join extends IJsonExport 
{
    int 	byTimer;  
    int 	byStartIndex;  
    int 	byOldOpen[] = new int[20];	
    
    String getJsonData(){
         String strOldOpen = sprintf_BYTE(byOldOpen,20);
     
         String str =  String.format("join|%d|%s\"",byTimer,strOldOpen);
         JSONObject json = new JSONObject();
 		 json.put("command", "fkfishmsg");
 		 json.put("fkfishmsg", str);
 	
 		return  json.toString();
  }
};
class SUBCMD_S_Room extends IJsonExport 
{
      int 	byTimer;  
      int 	byStartIndex;  
      int 	byOldOpen[] = new int[20];	
      
      
      String getJsonData(){
           String strOldOpen = sprintf_BYTE(byOldOpen,20);
       
           String str =  String.format("room|%d|%s\"",byTimer,strOldOpen);
           JSONObject json = new JSONObject();
   		 json.put("command", "fkfishmsg");
   		 json.put("fkfishmsg", str);
   	
   		return  json.toString();
    }
};
class SUBCMD_S_AllBet extends IJsonExport 
{
    public int     byTimer;    
    public int  	byStartIndex;  
    public int 	    dwAllBet[] = new int[16];  
    public  int 	dwLottery;  
  

	String getJsonData(){		
		String strAllBet = sprintf_DWORD(dwAllBet,16);
		String str =  String.format("allbet|%d|%s|%d\"",byTimer,strAllBet,dwLottery);
	
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};
class SUBCMD_S_Open extends IJsonExport 
{
    public int     byLotteryType;    
    public int  	byStartIndex;  
    public int 	    cbTableCardArray[] = new int[12];  
    public int 	    dwBet[] = new int[16];  
    public int 	    dwAllBet[] = new int[16];  
    public  int 	dwWinCoin;  
    public  int 	dwTotalCoin;  

	String getJsonData(){		
		String strResult = sprintf_BYTE(cbTableCardArray,12);
		String strBet = sprintf_DWORD(dwBet,16);
		String strAllBet = sprintf_DWORD(dwAllBet,16);
		String str =  String.format("open|%d|%d|%s|%s|%s|%d|%d\"",byLotteryType,byStartIndex,strResult,strBet,strAllBet,dwWinCoin,dwTotalCoin);
	
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};

class SUBCMD_S_UpdataBank extends IJsonExport 
{
   
    public  int 	dwBankCoin;  
    public  int 	dwTotalCoin;  
  
	String getJsonData(){		
		
		String str =  String.format("updataBank|%d|%d\"",dwBankCoin,dwTotalCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};
class SUBCMD_S_dhSuccess extends IJsonExport 
{
   
    public  int 	dwTotalCoin;  
  
	String getJsonData(){		
		
		String str =  String.format("dhSuccess|%d",dwTotalCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", str);
	
		return  json.toString();
	}
};
class SUBCMD_S_Leave extends IJsonExport {

	int m_lUid;
	String getJsonData() {

		String ttzmsg = String.format("leave|%d", m_lUid);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Offline extends IJsonExport {

	int m_lUid;
	String getJsonData() {

		String ttzmsg = String.format("offline|%d", m_lUid);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_CreateRoom extends IJsonExport {

	int cbResult;
	int cbRound;
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String ttzmsg = String.format("createroom|%d|%d|%d|%d", cbResult, cbRound, m_wUserChairID, m_dwTableID);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Param extends IJsonExport {

	int m_dwTableID;// ����ID
	String szParam;
	String szRoomDesc;
	String zhuangType;
	
	String getJsonData() {

		String ttzmsg = String.format("param|%d|%s|%s|%s", m_dwTableID, szParam,szRoomDesc,zhuangType);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_TryDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String ttzmsg = String.format("try_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_AgreeDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String ttzmsg = String.format("agree_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);

		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_RefuseDismissRoom extends IJsonExport {
	int lUid;
	String szNickName;//
	int dwTableID;// ����ID

	String getJsonData() {
		String ttzmsg = String.format("refuse_dismissroom|%d|%s|%d", lUid, szNickName, dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_DismissRoom extends IJsonExport {
	int cbResult;
	int lUid;
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String ttzmsg = String.format("dismissroom|%d|%d|%d|%d", cbResult, lUid, m_wUserChairID, m_dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_JoinRoom extends IJsonExport {
	int lUid;
	int cbResult;
	int dwTableID;
	int cbRound;
	int byParam[] = new int[20];
	String szGameName;
	String szGameDesc;
	
	String getJsonData() {

		String strParam = Arrays.toString(byParam);
		strParam = strParam.substring(1, strParam.length() - 1);

		String ttzmsg = String.format("joinroom|%d|%d|%d|%d|%s|%s|%s", lUid, cbResult, dwTableID, cbRound, strParam,
				szGameName, szGameDesc);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_AvatarURL extends IJsonExport { 		
	int	lUid;  
	String szURL;

	String getJsonData() {

		String ttzmsg = String.format("avatar|%d|%s", lUid, szURL);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Sit extends IJsonExport{		
	int	 m_lUid;      	
	int	 m_wUserChairID;
	int	 m_dwTableID;
	int	 m_lUserScore;
	String	szNickName;
	int	m_cbGender;
	int		m_iAvatar;
	String	szIP;
	int[] m_byRound = new int[5];
	double m_lUserCoin;
	
	String getJsonData() {
		String strM_byRound = sprintf_INT32(m_byRound, 5);
		
		String ttzmsg = String.format("sit|%d|%d|%d|%d|%s|%d|%d|%s|%s|%g", m_lUid, m_wUserChairID, m_dwTableID,
				m_lUserScore, szNickName, m_cbGender, m_iAvatar, szIP,strM_byRound,m_lUserCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);
		return json.toString();
	}
};

class SUBCMD_S_DenySit extends IJsonExport {
	int cbReason; // 1,û���ҵ�����,2����������

	String getJsonData() {

		String ttzmsg = String.format("denysit|%d", cbReason);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Look extends IJsonExport{ 
	int m_lUid;     	
	int m_wUserChairID;//����ID    	
	int m_iTotalCoin;
	String szNickName;

	String getJsonData() {

		String ttzmsg = String.format("look|%d|%d|%d|%d|%s", m_lUid, m_wUserChairID, m_iTotalCoin, szNickName);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_StandUp extends IJsonExport {

	int m_lUid;// ���ID
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String ttzmsg = String.format("standup|%d|%d|%d", m_lUid, m_wUserChairID, m_dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Kick extends IJsonExport {

	int m_lUid;// ���ID
	int m_wUserChairID;// ��λID
	int m_dwTableID;// ����ID

	String getJsonData() {

		String ttzmsg = String.format("kick|%d|%d|%d", m_lUid, m_wUserChairID, m_dwTableID);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

class SUBCMD_S_Ready extends IJsonExport {
	int m_lUid;// ���ID
	int m_wUserChairID;// �����λ
	int m_dwTableID;// ����ID
	int[] m_byRound = new int[5];
	
	String getJsonData() {

		String strM_byRound = sprintf_INT32(m_byRound, 5);
		
		String ttzmsg = String.format("ready|%d|%d|%d|%s", m_lUid, m_wUserChairID, m_dwTableID,strM_byRound);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);
		return json.toString();
	}
};

// �������
class SUBCMD_S_BiaoQing extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ
	int m_iBiaoQingIndex;

	String getJsonData() {

		String ttzmsg = String.format("biaoqing|%d|%d|%d", m_lUid, m_wUserChairID, m_iBiaoQingIndex);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

// ����
class SUBCMD_S_YuYin extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	int m_iYuYinIndex;

	String getJsonData() {

		String ttzmsg = String.format("yuyin|%d|%d|%d", m_lUid, m_wUserChairID, m_iYuYinIndex);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

// ����
class SUBCMD_S_SongLi extends IJsonExport {
	int m_srcUid;// �ĸ����ID���
	int m_dstUid;// �����λ ��
	int m_iLiWu;
	int m_srcCoin;// ����������¶���Ǯ
	int m_dstCoin;// ����������¶���Ǯ

	String getJsonData() {

		String ttzmsg = String.format("use|%d|%d|%d|%d|%d", m_srcUid, m_dstUid, m_iLiWu, m_srcCoin, m_dstCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

// ����
class SUBCMD_S_Avatar extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	String szAvatarURL;

	String getJsonData() {

		String ttzmsg = String.format("avatar|%d|%s", m_lUid, szAvatarURL);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

// ����
class SUBCMD_S_Chat extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	String szContent;

	String getJsonData() {

		String ttzmsg = String.format("chat|%d|%d|%s", m_lUid, m_wUserChairID, szContent);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};

// ����
class SUBCMD_S_Voice extends IJsonExport {
	int m_lUid;// �ĸ����ID���
	int m_wUserChairID;// �����λ��
	int seconds;
	String szVoiceURL;

	String getJsonData() {

		String ttzmsg = String.format("voice|%d|%d|%d|%s", m_lUid, m_wUserChairID, seconds, szVoiceURL);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};



class SSeatInfo {
	int m_lUid;// UID
	int m_lTotalScore;// COIN
	String m_NickName;// NICKNAME
	int m_iBetCoin;//
	int m_cbGender;//
	int m_iAvatar;//
	int m_cbUserStatus;// �û�״̬
	int m_iVipLevel;// VIP LEVEL
	int m_iTitle;// �ƺ�
	int m_isLookon;// �Ƿ����
	String szIP;
	double m_iTotalCoin;

	public String toString() {

		String ttzmsg = String.format("%d#%d#%s#%d#%d#%d#%d#%d#%d#%d#%s#%g", m_lUid, m_lTotalScore, m_NickName, m_iBetCoin,
				m_cbGender, m_iAvatar, m_cbUserStatus, m_iVipLevel, m_iTitle, m_isLookon, szIP,m_iTotalCoin);
		return ttzmsg;
	}
};

class SUBCMD_S_Table extends IJsonExport{ //ͬ�����������Ϣ
	int	 m_dwTableID;//����ID			
	int	m_bTableStarted;//ֻҪ��ʼ��
	int	m_byRound;//
	int	m_byMaxRound;//		
	int	m_bGameStarted;//��Ϸ��ʼ	
	int	m_cntUser;//�������
	int	m_cntLookon;//�������� 
	
	public SUBCMD_S_Table(){
		for (int i = 0; i < 1; i++) {
			 m_seatInfo[i] = new SSeatInfo();
		}
	}
	SSeatInfo	m_seatInfo[] = new SSeatInfo[1];
	public String getJsonData(){
		String ttzmsg = String.format("table|%d|%d|%d|%d|%d|%d|%d|%s", m_dwTableID, m_bTableStarted, m_byRound, m_byMaxRound,m_bGameStarted, m_cntUser, m_cntLookon,
			m_seatInfo[0].toString());
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);	
		
		return json.toString();		
	}
};

class SUBCMD_S_STAGE extends IJsonExport { // ͬ�����������Ϣ
	String szStage;
	int m_byZhuang;// ��ǰׯλ��
	int m_wZhuangPower;// ��ǰׯ�ı���
	int needDealTime;
	int m_byQiangZhuang[] = new int[5]; // �Ƿ���ׯ������ׯ�ı���
	int m_byXiaZhu[] = new int[5]; // ÿ���˵���ע
	int m_byXuanNiu[] = new int[5]; // ÿ���˵���עm_Creator
	int m_bTableCardArray[][] = new int[5][2]; // �����˿� //been 5
	int m_vecCardType[] = new int[5];
	int m_vecRoundScore[] = new int[5];

	public String getJsonData(){
		String strQiangZhuang = sprintf_INT32(m_byQiangZhuang, 5);
		String strXiaZhu = sprintf_INT32(m_byXiaZhu, 5);
		String strXuanNiu = sprintf_INT32(m_byXuanNiu, 5);

		String strTableCard = sprintf_BYTE(m_bTableCardArray, 10);
		String strCardType = sprintf_BYTE(m_vecCardType, 5);
		String strRoundScore = sprintf_INT32(m_vecRoundScore, 5);
		
		String ttzmsg = String.format("stage|%s|%d|%d|%d|%s|%s|%s|%s|%s|%s", szStage, m_byZhuang, m_wZhuangPower, needDealTime, strQiangZhuang, strXiaZhu, strXuanNiu, strTableCard, strCardType, strRoundScore);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);		
		return json.toString();
	}
};


class SUBCMD_S_REPORT extends IJsonExport {
	int cbReason;
	int whoDismiss;
	int vecMaxWinScore[] = new int[5];
	int vecWinScore[] = new int[5];
	int vecLoseScore[] = new int[5];
	double vecResultScore[] = new double[5];

	String getJsonData() {


		String strMaxWinScore = sprintf_INT32(vecMaxWinScore, 5);
		String strWinScore = sprintf_INT32(vecWinScore, 5);
		String strLoseScore = sprintf_INT32(vecLoseScore, 5);
		String strResultScore = sprintf_DOUBLE(vecResultScore, 5);

		String ttzmsg = String.format("report|%d|%d|%s|%s|%s|%s", cbReason, whoDismiss, strMaxWinScore, strWinScore,
				strLoseScore, strResultScore);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}

	String getData() {

		String strWinScore = sprintf_INT32(vecWinScore, 5);
		String strLoseScore = sprintf_INT32(vecLoseScore, 5);
		String strResultScore = sprintf_DOUBLE(vecResultScore, 5);

		return String.format("report|%d|%d|%s|%s|%s", cbReason, whoDismiss, strWinScore, strLoseScore, strResultScore);
	}
};

class SUBCMD_S_QiangZhuang extends IJsonExport {
	int lUid; // ��ǰ���
	int wChairID; // �����λ��
	int wPower; // ��ע���

	public String getJsonData() {

		String ttzmsg = String.format("qiangzhuang|%d|%d|%d", lUid, wChairID, wPower);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();			
	}
};

class SUBCMD_S_DingZhuang extends IJsonExport{
	int		lUid;					//��ǰ���
	int 	wChairID;				//�����λ�� 
	int		wPower;					//��ע���
	int		byQiangZhuang[] = new int[5];		//��ׯ��ҵĶ�����Ҫ

	public String getJsonData(){

		String strQiangZhuang = sprintf_BYTE(byQiangZhuang, 5);
		
		String ttzmsg = String.format("dingzhuang|%d|%d|%d|%s", lUid, wChairID, wPower, strQiangZhuang);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();	
		
	}
};

class SUBCMD_S_XiaZhu extends IJsonExport {
	int lUid; // ��ǰ���
	int wChairID; // �����λ��
	int wPower; // ��ע���

	public String getJsonData() {
		String ttzmsg = String.format("xiazhu|%d|%d|%d", lUid, wChairID, wPower);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();		
	}
};

class SUBCMD_S_JieSuan extends IJsonExport {
	double nRoundScore[] = new double[5];
	int nUserScore[] = new int[5];
	int bCardType[] = new int[5]; // �û��˿�����
	int bCardData[][] = new int[5][2]; // �û��˿�

	double lShuiShou[] = new double[5];
	double lUserCoin[] = new double[5];
	public String getJsonData(){

		String strRoundScore = sprintf_DOUBLE(nRoundScore, 5);
		String strResultScore = sprintf_INT32(nUserScore, 5);
		String strCardType = sprintf_BYTE(bCardType, 5);

		int	tmpCardData[] = new int[5*2];			//�û��˿�
		for (int i = 0; i < 5; i++)
		{
			for (int k = 0; k < 2; k++)
			{
				tmpCardData[i * 2 + k] = bCardData[i][k];
			}
		}
		String strCardData = sprintf_BYTE(tmpCardData, 10);
		String userShui = sprintf_DOUBLE(lShuiShou,5);
		String userCoin = sprintf_DOUBLE(lUserCoin,5);

		String ttzmsg = String.format("jiesuan|%s|%s|%s|%s|%s|%s", strRoundScore, strResultScore, strCardType, strCardData,userShui,userCoin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", ttzmsg);

		return json.toString();
	}
};


class SUBCMD_S_VoiceMsg extends IJsonExport{
	int m_lUid;
	int m_wUserChairID;
	int m_maxClip;
	int m_currClip;
	float seconds;
	String data;
	
	String getJsonData() {

		String msg = String.format("voicemsg|%d|%d|%f|%s|%d|%d", m_lUid, m_wUserChairID, seconds, data,m_maxClip,m_currClip);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", msg);

		return json.toString();
	}
};

class SUBCMD_S_ExprMsg extends IJsonExport{
	int m_uid1;
	int m_uid2;
	int m_index;
	String getJsonData() {

		String mjmsg = String.format("expr|%d|%d|%d", m_uid1, m_uid2,m_index);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", mjmsg);

		return json.toString();
	}
};
class SUBCMD_S_InFore extends IJsonExport{
	int byActionUser;
	String getJsonData(){
		String niuniumsg = String.format("inFore|%d", byActionUser);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", niuniumsg);
		return json.toString();
	}
}

class SUBCMD_S_InBack extends IJsonExport{
	int byActionUser;
	String getJsonData(){
		String niuniumsg = String.format("inBack|%d", byActionUser);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", niuniumsg);
		return json.toString();
	}
}

class SUBCMD_S_OnLine extends IJsonExport{
	int uid;
	int seat;
	String getJsonData(){
		String mjmsg = String.format("online|%d|%d", uid,seat);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", mjmsg);
		return json.toString();
	}
}

class SUBCMD_S_GameIap extends IJsonExport{
	int uid;
	int seat;
	int coin;
	String getJsonData(){
		String mjmsg = String.format("gameiap|%d|%d|%d", uid,seat,coin);
		JSONObject json = new JSONObject();
		json.put("command", "fkfishmsg");
		json.put("fkfishmsg", mjmsg);
		return json.toString();
	}
}

class FishUseItemResult{
	public int out_cntItem;
	public int out_costGem;
	public double out_costRmb;
}
class FishConfig{
	public int m_iType;
	public int m_iOdds;
	public int m_iBlood;
	public int m_iSpeed;
	public int m_iBornLimit;
	public int m_iMaxLimit;
	public FishConfig(int type,int odds,int blood,int speed,int bornlimit,int maxlimit){
		m_iType = type;
		m_iOdds = odds;
		m_iBlood = blood;
		m_iSpeed = speed;
		m_iBornLimit = bornlimit;
		m_iMaxLimit = maxlimit;
	}
}
class FishInfo{
	public long m_tBirthTime;
	public int m_iFishID;
	public int m_iFishType;
	public int m_iPathId;
	public int m_iBlood;
	public int m_iStatus;
	public int m_iOdds;
	public int m_iEatCoin;
	public double m_iEatRmb;
}

class tagSeatInfo{
	public int dwUserID;
	public int cannonLevel;
	public int isAndroidUser;
	public tagSeatInfo(){
		dwUserID = 0;
		cannonLevel = 0;
		isAndroidUser = 0;
	}
}

class MSG_AddFish{
	public long m_tBirthTime;
	public long m_tNowTime;
	public int[] m_iFishId;
	public int m_iFishType;
	public int m_iPathId;
	public int m_iNum;
	public int m_iDirection;
	public int m_iDeviation;
	public int m_iSpeed;
	public MSG_AddFish(){
		clean();
	}
	public void clean(){
		m_tBirthTime = 0;
		m_tNowTime = 0;
		m_iFishId = new int[10];
		m_iFishType = 0;
		m_iPathId = 0;
		m_iNum = 0;
		m_iDirection = 0;
		m_iDeviation = 0;
		m_iSpeed = 0;
	}
	public void copyFromAddFishCmd(SUBCMD_S_AddFish cmd){
		this.m_tBirthTime = cmd.m_tBirthTime;
		this.m_tNowTime = cmd.m_tNowTime;
		this.m_iFishId = cmd.m_iFishId;
		this.m_iFishType = cmd.m_iFishType;
		this.m_iPathId = cmd.m_iPathId;
		this.m_iNum = cmd.m_iNum;
		this.m_iDirection = cmd.m_iDirection;
		this.m_iDeviation = cmd.m_iDeviation;
		this.m_iSpeed = cmd.m_iSpeed;
	}
}

class MSG_AddYuChao{
	public int m_tBirthTime;
	public int m_tNowTime;
	public int m_iYuChaoType;
	public int m_iStartID;
	public MSG_AddYuChao(){
		clean();
	}
	public void clean(){
		m_tBirthTime = 0;
		m_tNowTime = 0;
		m_iYuChaoType = 0;
		m_iStartID = 0;
	}
}

class FishMsgBase{
	public String command;
	public String type;
	public FishMsgBase(){
		type = "";
		command = "fkfishmsg";
	}
}
class FishSeatInfo extends FishMsgBase{
	public int m_lUid;
	public int m_iSeatId;
	public int m_iVipLevel;
	public int m_iCoin;
	public double m_rmb;
	public int m_iGem;
	public int m_iCannonAvatar;
	public int m_iCannonLevel;
	public int m_iMaxCannonLevel;
	public int m_iCannonCost;
	public String m_sNickName;
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_JoinTable extends FishMsgBase{
	public int m_lUid;
	public int m_iRoomId;
	public int m_iBase;
	public FishSeatInfo[] m_seatInfo;
	public SUBCMD_S_JoinTable(){
		m_seatInfo = new FishSeatInfo[4];
		type = "SUBCMD_S_JoinTable";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_LeaveTable extends FishMsgBase{
	public int m_lUid;
	public SUBCMD_S_LeaveTable(){
		type = "SUBCMD_S_LeaveTable";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_RoomInfo extends FishMsgBase{
	public int m_iRoomId;
	public int m_iBase;
	public FishSeatInfo[] m_seatInfo;
	public SUBCMD_S_RoomInfo(){
		type = "SUBCMD_S_RoomInfo";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_AddFish extends FishMsgBase{
	public long m_tBirthTime;
	public long m_tNowTime;
	public int[] m_iFishId;
	public int m_iFishType;
	public int m_iPathId;
	public int m_iNum;
	public int m_iDirection;
	public int m_iDeviation;
	public int m_iSpeed;
	public SUBCMD_S_AddFish(){
		m_iFishId = new int[10];
		type = "SUBCMD_S_AddFish";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_AddYuChao extends FishMsgBase{
	public long m_tBirthTime;
	public long m_tNowTime;
	public int m_iYuChaoType;
	public int m_iStartID;
	public SUBCMD_S_AddYuChao(){
		type = "SUBCMD_S_AddYuChao";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_DoFire extends FishMsgBase{
	public int m_lUid;
	public double m_lTotalCoin;
	public int m_iSeat;
	public int m_iCannonLevel;
	public int m_rotation;
	public SUBCMD_S_DoFire(){
		type = "SUBCMD_S_DoFire";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_AdjustCannon extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iCannonLevel;
	public int m_iCost;
	public SUBCMD_S_AdjustCannon(){
		type = "SUBCMD_S_AdjustCannon";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//update cannon
class SUBCMD_S_UpgradeCannon extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iReault;
	public int m_iMaxCannonLevel;
	public int m_iCostGem;
	public double m_iAddCoin;
	public SUBCMD_S_UpgradeCannon(){
		type = "SUBCMD_S_UpgradeCannon";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_UpgradeCannon1 extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iResult;
	public int m_iMaxCannonLevel;
	public double m_iNeedCoin;
	public SUBCMD_S_UpgradeCannon1(){
		type = "SUBCMD_S_UpgradeCannon1";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//hit
class SUBCMD_S_Catch extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_xPoint;
	public int m_yPoint;
	public double m_iAddCoin;
	public int m_iAddGem;
	public double m_iTotalCoin;
	public int m_iTotalGem;
	public int m_iOdds;
	public int[] m_iFishId;
	public SUBCMD_S_Catch(){
		m_iFishId = new int[10];
		type = "SUBCMD_S_Catch";		
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//get item
class SUBCMD_S_GiveItem extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_xPoint;
	public int m_yPoint;
	public int[] m_iGiveItem;
	public SUBCMD_S_GiveItem(){
		type = "SUBCMD_S_GiveItem";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
	public static void addGiveItem(SUBCMD_S_GiveItem item,int item_id,int item_cnt){
		for(int i = 0;i < 8;i++){
			if(item.m_iGiveItem[2 * i] == 0){
				item.m_iGiveItem[2 * i] = item_id;
				item.m_iGiveItem[2 * i + 1] = item_cnt;
				break;
			}
		}
	}
}
//save life gold
class SUBCMD_S_AlmsCountDown extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public long m_iCountDown;
	public SUBCMD_S_AlmsCountDown(){
		type = "SUBCMD_S_AlmsCountDown";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//who`s alms
class SUBCMD_S_Alms extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iAlms;
	public SUBCMD_S_Alms(){
		type = "SUBCMD_S_Alms";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_UseItem extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iItemId;
	public int m_iTemUsed;
	public int m_iItemCount;
	public double m_iCostCoin;
	public int m_iCostGem;
	public double m_iTotalCoin;
	public int m_iTotalGem;
	public SUBCMD_S_UseItem(){
		type = "SUBCMD_S_UseItem";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_Freeze extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iRemainTime;
	public SUBCMD_S_Freeze(){
		type = "SUBCMD_S_Freeze";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
class SUBCMD_S_Lamp extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iFishType;
	public int m_iFishID;
	public SUBCMD_S_Lamp(){
		type = "SUBCMD_S_Lamp";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//lock
class SUBCMD_S_Lock extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public int m_iRemainTime;
	public SUBCMD_S_Lock(){
		type = "SUBCMD_S_Lock";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}
//wild
class SUBCMD_S_Wild extends FishMsgBase{
	public int m_lUid;
	public int m_iSeat;
	public SUBCMD_S_Wild(){
		type = "SUBCMD_S_Wild";
	}
	public String toString(){
		return JsonUtils.serialize(this);
	}
}